<template>
  <div class="standards-management-container">
    <el-card class="search-card">

      <!-- 搜索条件区域 - 改为纵向排列 -->
      <div class="search-filters">
        <!-- 行业筛选 -->
        <div class="filter-group">
          <span class="filter-label">行业：</span>
          <span class="all-button"
            :class="{ 'active': selectedIndustry === '' || selectedIndustry === null || selectedIndustry === undefined }"
            @click="handleAllButtonClick('industry')">
            全部
          </span>
          <el-radio-group v-model="selectedIndustry" size="small" @change="handleChangehy">
            <el-radio-button v-for="item in industryOptions" :key="item.id" :label="item.name">
              {{ item.name }}
            </el-radio-button>
          </el-radio-group>
        </div>

        <!-- 分类筛选 -->
        <div class="filter-group">
          <span class="filter-label">分类：</span>
          <span class="all-button"
            :class="{ 'active': selectedCategory === '' || selectedCategory === null || selectedCategory === undefined }"
            @click="handleAllButtonClick('category')">
            全部
          </span>
          <el-radio-group v-model="selectedCategory" size="small" @change="handleCategoryChange">
            <el-radio-button v-for="item in categoryOptions" :key="item.id" :label="item.name">
              {{ item.name }}
            </el-radio-button>
          </el-radio-group>
        </div>

        <!-- 状态筛选 -->
        <div class="filter-group">
          <span class="filter-label">状态：</span>
          <span class="all-button"
            :class="{ 'active': selectedStatus === '' || selectedStatus === null || selectedStatus === undefined }"
            @click="handleAllButtonClick('status')">
            全部
          </span>
          <el-radio-group v-model="selectedStatus" size="small">
            <el-radio-button v-for="item in statusOptions" :key="item.dictValue"
              :label="getButtonLabel(item.dictLabel)">
              {{ item.dictLabel }}
            </el-radio-button>
          </el-radio-group>
        </div>


        <div class="filter-group">

          <span class="filter-label">查询:</span>
          <!-- 添加点击事件 -->
          <input v-model="searchQuery" placeholder="请输入查询内容" size="small" prefix-icon="el-icon-search" :clearable="true"
            class="searchinput" @keyup.enter="QueryScriptlist">


          <button type="primary" size="small" @click="QueryScriptlist" icon="el-icon-refresh-left" class="resetbutton2">
            <i class="el-icon-search"></i>
            <span>查询</span>
          </button>
          <button type="primary" size="small" @click="handleReset" icon="el-icon-refresh-left" class="resetbutton">
            <i class="el-icon-refresh-left"></i>
            <span>重置</span>
          </button>


        </div>
        <div class="filter-group">
          <span class="filter-label">脚本:</span>
          <!-- 添加点击事件 -->

          <button @click="showExecuteDialog" class="execute-button">
            <span>执行</span>
          </button>

        </div>
      </div>
    </el-card>

    <el-card style="background-color: #04142B;border: none;max-width: 1600px;margin: 0 auto;">
      <el-table :data="testData" style="width: 100%" border class="custom-table"
        :header-cell-style="{ textAlign: 'center' }" :cell-style="{ textAlign: 'center' }">
        <el-table-column prop="taskName" label="任务名称" />
        <el-table-column prop="classify" label="脚本" />
        <!-- <el-table-column prop="url" label="地址" :show-overflow-tooltip="false" /> -->
        <el-table-column prop="url" label="地址">
          <template slot-scope="scope">
            {{ truncateUrl(scope.row.url) }}
          </template>
        </el-table-column>
        <el-table-column label="执行状态">
          <template slot-scope="scope">
            <span v-if="scope.row.status === '1'">准备采集</span>
            <span v-else-if="scope.row.status === '2'">采集中</span>
            <span v-else-if="scope.row.status === '3'">入库中</span>
            <span v-else-if="scope.row.status === '4'">清洗中</span>
            <span v-else-if="scope.row.status === '5'">采集完成</span>
          </template>
        </el-table-column>
        <el-table-column prop="startTime" label="日期" />
        <el-table-column fixed="right" label="操作">
          <template slot-scope="scope">
            <div style="display: flex; gap: 10px;">
              <button @click="handlestep(scope.row)" v-if="scope.row.status !== '5'"
                class="action-button"><span>查看进度</span></button>
              <button @click="handleClick(scope.row)" v-if="scope.row.status === '5'"
                class="action-button"><span>查看数据</span></button>
              <button @click="DownClickfile(scope.row)" v-if="scope.row.status === '5'"
                class="action-button"><span>下载</span></button>
            </div>
            <!-- 下载成功弹窗 -->
            <el-dialog title="" :visible.sync="downloadSuccessVisible" width="620px" center :show-close="true"
              custom-class="success-dialog" append-to-body :modal="false">
              <div class="success-content">
                <img src="../../assets/img/pro/filesuccess.png" alt="下载成功" class="success-icon">
                <p class="success-text">下载文件成功</p>
              </div>
            </el-dialog>

            <!-- 脚本执行成功弹窗 -->
            <el-dialog title="" :visible.sync="scriptSuccessVisible" width="620px" center :show-close="true"
              custom-class="success-dialog" append-to-body :modal="false">
              <div class="success-content">
                <img src="../../assets/img/pro/filesuccess.png" alt="执行成功" class="success-icon">
                <p class="success-text">执行脚本成功</p>
              </div>
            </el-dialog>
          </template>
        </el-table-column>

      </el-table>
    </el-card>

    <!-- 执行脚本弹窗 -->
    <el-dialog title="执行脚本" :visible.sync="executeDialogVisible" width="620px" center :show-close="false"
      :before-close="handleDialogClose">
      <el-form :model="executeForm" ref="executeForm" :rules="executeRules" label-width="80px">
        <!-- 采集名称 -->
        <el-form-item label="采集名称" prop="name">
          <el-input v-model="executeForm.name" placeholder="请输入采集名称" />
        </el-form-item>

        <!-- 分类下拉菜单 -->
        <el-form-item label="采集分类" prop="category">
          <el-select v-model="executeForm.category" placeholder="请选择分类" style="width: 100%;"
            @change="handleExecuteCategoryChange">
            <el-option v-for="item in collectOptions" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>

        <!-- 地址输入框 -->
        <el-form-item label="采集地址" prop="address">
          <el-input v-model="executeForm.address" placeholder="选择分类自动同步地址" disabled />
        </el-form-item>
      </el-form>


      <span slot="footer" class="dialog-footer"
        style="display: flex;align-items: center;justify-content: space-around;">
        <button type="primary" class="dialogqxbtn" @click="handleDialogClose"><span>取消</span></button>
        <button type="primary" class="dialogqxTwo" @click="handleExecuteConfirm"><span>提交</span></button>
      </span>
    </el-dialog>

    <el-dialog :visible.sync="stepDialog" width="800px" class="custom-step-dialog">
      <div class="dialog-content">
        <div class="info-row">
          <span class="info-label">{{ stepDatalist.classify }}</span>
          <span class="skewed-tag">{{ stepDatalist.classify }}</span>
        </div>
        <div class="info-row">
          <span class="info-latwo">地址: {{ truncatelongUrl(stepDatalist.url) }}</span>
          <span class="info-time">执行时间: {{ stepDatalist.startTime }}</span>
        </div>
      </div>
      <div style="height: 300px;padding: 20px 0;">
        <el-steps direction="vertical" :active="currentStep" finish-status="success" align-center space="86px"
          v-if="dynamicSteps.length > 0">
          <el-step v-for="(step, index) in dynamicSteps" :key="index" :title="step.title"
            :description="step.description"></el-step>
        </el-steps>
        <div v-else style="text-align: center; padding: 50px 0; color: #999;">
          暂无进度信息
        </div>
      </div>
    </el-dialog>

    <el-dialog title="脚本执行详情" :visible.sync="watchDialog" width="1200px">
      <el-table :data="collectData" style="width: 100%" border v-if="isLoaded">
        <!-- 动态生成列 -->
        <template v-if="collectData && collectData.length > 0 && tableColumns.length > 0">
          <el-table-column v-for="column in tableColumns" :key="column.prop" :prop="column.prop" :label="column.label"
            :show-overflow-tooltip="true">
          </el-table-column>
        </template>
        <!-- 空状态展示 -->
        <template v-else-if="isLoaded">
          <el-empty description="暂无数据" />
        </template>
      </el-table>
      <!-- 加载状态 -->
      <div v-else style="text-align: center; padding: 40px;">
        <i class="el-icon-loading el-icon--loading" style="margin-right: 10px; font-size: 20px;"></i>
        <span>加载中...</span>
      </div>
      <span slot="footer" class="dialog-footer" style="margin: 10px 0;">
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { getDictList, getIndustryCategory, getCollectList, getCollectDetailList, GcDownloadCollectList, GcAddCollectTask, getCollectProgress } from '../../api/user';
export default {
  name: 'StandardsManagement',
  data() {
    return {
      // 筛选条件选项
      downloadSuccessVisible: false,
      scriptSuccessVisible: false,
      stepDialog: false,
      industryOptions: [

      ],
      categoryOptions: [

      ],
      statusOptions: [

      ],
      collectOptions: [
        {
          value: 'https://b2b.baidu.com/s?q=%E9%80%9A%E4%BF%A1%E8%AE%BE%E5%A4%87&from=search&fid=0%2C1760002325610&pi=b2b.index.search...0198642558335706',
          label: '通信设备制造'
        },
        {
          value: 'https://b2b.baidu.com/s?q=%E9%80%9A%E4%BF%A1%E7%BD%91%E7%BB%9C&from=search&fid=0%2C1760002325610&pi=b2b.s.search...9887724918419865',
          label: '通信网络规划与建设'
        },
        {
          value: 'https://b2b.baidu.com/s?q=%E9%80%9A%E4%BF%A1%E6%8A%80%E6%9C%AF%E6%9C%8D%E5%8A%A1&from=search&fid=0%2C1760002325610&pi=b2b.s.search...4304549565214177',
          label: '电信增值'
        },
        {
          value: 'https://b2b.baidu.com/s?q=%E5%B9%BF%E6%92%AD%E7%94%B5%E8%A7%86%E9%80%9A%E4%BF%A1&from=search&fid=0%2C1760002325610&pi=b2b.s.search...3119085777122158',
          label: '广播电视通信'
        },
        {
          value: 'https://b2b.baidu.com/s?q=%E5%9B%BA%E5%AE%9A%E9%80%9A%E4%BF%A1&from=search&fid=0%2C1760002325610&pi=b2b.s.search...4122510840186232',
          label: '固定通信'
        },
        {
          value: 'https://b2b.baidu.com/s?q=%E5%8D%AB%E6%98%9F%E9%80%9A%E4%BF%A1&from=search&fid=0%2C1760002325610&pi=b2b.s.search...4770281399951534',
          label: '卫星通信'
        },
        {
          value: 'https://b2b.baidu.com/s?q=%E5%B7%A5%E4%B8%9A%E7%BA%A7%E6%97%A0%E7%BA%BF%E8%B7%AF%E7%94%B1%E5%99%A8&from=search&fid=0%2C1760002325610&pi=b2b.s.search...7473073540965859',
          label: '蜂窝移动通信'
        },
        {
          value: 'https://b2b.baidu.com/s?q=%E6%95%B0%E6%8D%AE%E9%87%87%E9%9B%86%E4%BC%A0%E8%BE%93%E4%BB%AA&from=search&fid=0%2C1760002325610&pi=b2b.s.search...3231457197865355',
          label: '数据通信'
        },
      ],
      testData: [
      ],
      totalList: 0,
      currentStep: -1,
      dynamicSteps: [],
      stepDatalist: [],
      collectData: [],
      tableColumns: [],
      isLoaded: false,
      // 选中的筛选条件
      selectedIndustry: '',
      selectedCategory: '',
      selectedStatus: '',
      searchQuery: '',
      watchDialog: false,
      // 弹窗相关
      executeDialogVisible: false,
      executeForm: {
        name: '',
        category: '',
        address: ''
      },
      paggagefenye: {
        taskID: '',

      },
      pageSize: 10,
      currentPage: 1,
      // 表单验证规则
      executeRules: {

        category: [
          { required: true, message: '请选择分类', trigger: 'change' }
        ],

      }
    };
  },
  created() {
    this.gethyeList();
    this.QueryScriptlist()
    this.getDictCollect()
  },

  methods: {

    headerCellStyle() {
      return { color: '#303133', background: '#f5f7fa' }
    },
    cellStyle() {
      return { color: '#303133', background: '#ffffff' }
    },
    // 处理筛选条件变化
    handleFilterChange(value) {
      if (value === '准备采集') {
        this.selectedStatus = 1;
      } else if (value === '采集中') {
        this.selectedStatus = 2;
      } else if (value === '入库中') {
        this.selectedStatus = 4;
      } else if (value === '清洗中') {
        this.selectedStatus = 3;
      } else if (value === '完成') {
        this.selectedStatus = 5;
      }
      this.QueryScriptlist();
    },

    // 获取按钮标签对应的数字值
    getButtonLabel(label) {
      switch (label) {
        case '准备采集': return 1;
        case '采集中': return 2;
        case '清洗中': return 3;
        case '入库中': return 4;
        case '完成': return 5;
        default: return '';
      }
    },
    truncateUrl(url) {
      if (!url) return '';
      // 截取URL前50个字符，超过部分显示省略号
      return url.length > 50 ? url.substring(0, 22) + '...' : url;
    },
    truncatelongUrl(url) {
      if (!url) return '';
      // 截取URL前50个字符，超过部分显示省略号
      return url.length > 50 ? url.substring(0, 32) + '...' : url;
    },
    handleCategoryChange(value) {
      this.selectedCategory = value;
    },
    // 处理搜索
    handleChangehy(value) {
      this.selectedIndustry = value;
    },
    // 处理全部按钮点击
    handleAllButtonClick(type) {
      if (type === 'industry') {
        this.selectedIndustry = '';
      } else if (type === 'category') {
        this.selectedCategory = '';
      } else if (type === 'status') {
        // 重置状态筛选，确保与模板中的active类判断条件一致
        this.selectedStatus = '';
      }
      this.QueryScriptlist();
    },
    gethyeList() {
      getIndustryCategory()
        .then(res => {
          // 检查res和res.data是否存在
          if (!res || !res.data || !Array.isArray(res.data)) {
            return;
          }
          this.industryOptions = res.data

          // 方法1: 根据id或name查找目标数据（推荐）
          // 假设我们需要查找id为1的"通信"分类下的子分类
          const targetItem = res.data.find(item => item.id === 1 || item.name === '通信');

          // 如果找到了目标项且它有childArray，就使用它
          if (targetItem && targetItem.childArray) {
            this.categoryOptions = targetItem.childArray;
          } else {
            // 备选方案: 使用第一个有childArray的项
            const firstValidItem = res.data.find(item => item.childArray && Array.isArray(item.childArray));
            if (firstValidItem) {
              this.categoryOptions = firstValidItem.childArray;
            } else {
              // 如果都找不到，使用默认空数组避免报错
              this.categoryOptions = [];
            }
          }
        })
        .catch(error => {
          console.error('获取行业分类数据失败:', error);
          this.categoryOptions = []; // 出错时设置为空数组
        })
    },

    // 根据value获取option的label
    getOptionLabel(value, options) {
      const option = options.find(item => item.value === value);
      return option ? option.label : value;
    },

    handlestep(row) {
      //  console.log(row.taskId) 
      this.stepDialog = true
      getCollectProgress(row.taskId).then(res => {
        if (res.code === 200) {
          this.stepDatalist = res.data
          // 解析message中的状态信息并动态生成步骤列表
          this.dynamicSteps = []
          if (res.data.message) {
            try {
              const messageData = JSON.parse(res.data.message)
              //  console.log('解析后的message数据:', messageData)
              // 步骤配置信息，考虑拼写错误的情况
              const stepMapping = {
                1: { title: '准备采集', keys: ['status1', 'ststus1'] },
                2: { title: '采集中', keys: ['status2', 'ststus2'] },
                3: { title: '清洗中', keys: ['status3', 'ststus3'] },
                4: { title: '入库中', keys: ['status4', 'ststus4'] },
                5: { title: '完成', keys: ['status5', 'ststus5'] }
              }

              // 动态生成步骤列表，支持两种拼写方式
              for (let i = 1; i <= 5; i++) {
                const config = stepMapping[i]
                // 查找正确的键名
                let value = null
                for (const key of config.keys) {
                  if (messageData[key]) {
                    value = messageData[key]
                    break
                  }
                }

                // 如果找到值，添加到步骤列表
                if (value) {
                  this.dynamicSteps.push({
                    title: config.title,
                    description: value
                  })
                }
              }

              // 设置当前激活步骤为最后一个存在的步骤
              this.currentStep = this.dynamicSteps.length - 1
              //  console.log('动态生成的步骤:', this.dynamicSteps)
              //  console.log('当前激活步骤:', this.currentStep)
            } catch (e) {
              console.error('解析message失败:', e)
              this.currentStep = -1
              this.dynamicSteps = []
            }
          }
        }
      })
    },

    // 动态生成表格列
    generateTableColumns() {
      if (!this.collectData || this.collectData.length === 0) {
        this.tableColumns = [];
        return;
      }

      // 获取第一个数据项的所有属性
      const firstItem = this.collectData[0];
      // 过滤掉不需要显示的字段
      const properties = Object.keys(firstItem).filter(prop => prop !== 'potherParam' && prop !== 'pid' && prop !== 'grouping');

      // 属性名到中文标签的映射，可以根据需要扩展
      const labelMap = {
        'pid': '产品ID',
        'name': '产品名称',
        'pname': '产品名称',
        'pcolor': '产品颜色',
        'ptype': '产品类型',
        'psaleScope': '销售范围',
        'pspeed': '处理速度',
        'pmodel': '产品型号',
        'pinterface': '通信接口',
        'brand': '品牌',
        'companyName': '生产企业',
        'pcategory': '产品类别',
        'ppower': '电源规格',
        'pweight': '产品重量',
        'pcommInterface': '通信接口',
        'grouping': '分组ID',
        'time': '时间',
        'pmountWay': '挂载方式',
        'poutPower': '输出功率',
        'poutCurrent': '输出电流',
        'poutVoltage': '输出电压',
        'pinputVoltage': '输入电压',
        'psummary': '产品概诉',
        'ppackage': '产品包装',
        'prohs': '是否 Rohs 认证',
        'pworkTem': '工作温度',
        'plifeCycle': '生产周期',
        'pworkVoltage': '工作电压',
        'pprotocol': '通信协议',
        'pfrequencyBand': '工作频段',
        'pfrequencyBands': '工作频段',
        'ptechStd': '技术规格',
        'txPower': '发射功率',
        'ppowerConsumption': '功耗',
        'pbatteryLife': '电池寿命',
        'pcomminterface': '通信接口',
        'pmountway': '挂载方式',
        'pscreenType': '屏幕类型',
        'pcableType': '电缆类型',
        'pimpedanceOhm': '阻抗（欧姆）',
        'pcoreMm': '核心尺寸（mm）',
        'pvelocityRatio': '传输速率比',
        'pmaterial': '材质',
        'pprodType': '产品类型',
        'precvBand': '接收频段',
        'psize': '产品尺寸',
        'ppolarization': '极化方式',
        'poutputWay': '输出方式',
        'plnbNoiseFigure': 'LNB 噪声系数',
        'pouterMm': '外部尺寸（mm）',
        // 可以根据实际数据结构扩展更多映射
      };

      // 生成列定义
      this.tableColumns = properties.map(prop => ({
        prop: prop,
        label: labelMap[prop] || this.formatLabel(prop) // 使用映射或格式化后的属性名
      }));
    },

    // 将属性名格式化为更友好的标签
    formatLabel(prop) {
      // 转换驼峰命名为空格分隔的中文风格标签
      return prop
        .replace(/([A-Z])/g, ' $1') // 在大写字母前添加空格
        .replace(/^./, str => str.toUpperCase()) // 首字母大写
        .replace(/^P/, '') // 移除可能的前缀'p'
        .trim();
    },

    handleClick(row) {
      localStorage.setItem('taskID', row.taskId)
      // 显示弹窗
      this.watchDialog = true;
      this.isLoaded = false; // 重置加载状态
      this.tableColumns = []; // 清空列定义

      getCollectDetailList(row.taskId).then(response => {
        this.collectData = response.data || [];

        // 如果有数据，动态生成列定义
        if (this.collectData.length > 0) {
          this.generateTableColumns();
        }

        this.isLoaded = true;
      }).catch(error => {
        console.log('请求错误:', error);
        this.isLoaded = true;
      })
    },
    DownClickfile(row) {
      GcDownloadCollectList(
        row.taskId,
      ).then(res => {


        try {
          // 创建Blob对象
          const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });

          // 创建下载链接
          const link = document.createElement('a');
          const url = URL.createObjectURL(blob);
          link.href = url;
          link.setAttribute('download', '数据采集脚本.xlsx');
          // 添加到DOM并触发点击
          document.body.appendChild(link);
          link.click();

          // 清理资源
          setTimeout(() => {
            document.body.removeChild(link);
            URL.revokeObjectURL(url);
          }, 100);

          // 显示下载成功弹窗
          this.downloadSuccessVisible = true;
          // 2秒后自动关闭弹窗
          setTimeout(() => {
            this.downloadSuccessVisible = false;
          }, 2000);
        } catch (err) {
          this.$message.error('下载失败，请重试', 1000);
        }
      }).catch(error => {
        console.log('请求错误:', error)
        this.isLoaded = true
      })
    },

    // 弹窗相关方法
    showExecuteDialog() {
      // 重置表单
      this.$refs.executeForm && this.$refs.executeForm.resetFields();
      // 显示弹窗
      this.executeDialogVisible = true;
    },

    handleDialogClose() {
      // 关闭弹窗
      this.executeDialogVisible = false;
    },

    handleExecuteConfirm() {
      // 表单验证
      this.$refs.executeForm.validate((valid) => {
        if (valid) {
          // 验证通过，执行脚本逻辑
          // 获取选中分类的中文名（label）
          const selectedOption = this.collectOptions.find(item => item.value === this.executeForm.category);
          const classify = selectedOption ? selectedOption.label : '';

          // 准备请求参数
          const params = {
            classify: classify,
            url: this.executeForm.address,
            taskName: this.executeForm.name,
          };


          // 调用数据采集接口
          GcAddCollectTask(params).then(response => {
            console.log(response);
            // 关闭加载提示
            // 处理成功响应
            // 显示脚本执行成功弹窗
            this.scriptSuccessVisible = true;
            // 2秒后自动关闭弹窗
            setTimeout(() => {
              this.scriptSuccessVisible = false;
            }, 2000);
            this.QueryScriptlist()
            // 可以在这里添加成功后的处理逻辑，比如刷新列表等
            this.executeDialogVisible = false;
          }).catch(error => {
            // 关闭加载提示

            // 处理错误响应
            console.error('数据采集任务执行失败:', error);
            this.$message.error('脚本执行失败，请稍后重试', 1000);
          });
        } else {
          // 验证失败
          return false;
        }
      });
    },


    QueryScriptlist() {
      getCollectList({
        // 只有当参数有实际值时才展开添加
        ...(this.searchQuery && this.searchQuery.trim() !== '' ? { taskName: this.searchQuery } : {}),
        ...(this.selectedStatus && this.selectedStatus !== '' && this.selectedStatus !== null && this.selectedStatus !== undefined ? { status: this.selectedStatus } : {}),
        // 优先使用分类选择的值作为classify，如果分类未选择则使用行业选择的值
        ...((this.selectedCategory && this.selectedCategory !== '' && this.selectedCategory !== null && this.selectedCategory !== undefined) ?
          { classify: this.selectedCategory } :
          (this.selectedIndustry && this.selectedIndustry !== '' && this.selectedIndustry !== null && this.selectedIndustry !== undefined ?
            { classify: this.selectedIndustry } : {})),
      }).then(res => {
        if (res.code === 200) {
          this.testData = res.rows;
        } else {
          this.$message.error('获取数据失败', 1000);
        }
      })
    },
    async handleSizeChange(val) {
      this.pageSize = val;
      const taskID = localStorage.getItem('taskID')
      this.handleClick(taskID)
    },
    async handleCurrentChange(val) {
      this.currentPage = val;
      const taskID = localStorage.getItem('taskID')
      this.handleClick(taskID)


    },
    // 新增：处理分类选择变化，自动填充地址


    // 处理弹窗中的分类选择变化，自动填充地址
    handleExecuteCategoryChange(value) {
      // 找到对应的选项
      const selectedOption = this.collectOptions.find(item => item.value === value);
      if (selectedOption) {
        // 自动设置地址为选择的分类对应的value
        this.executeForm.address = selectedOption.value;
      }
    },

    getDictCollect() {
      getDictList("task_status").then(res => {
        console.log(res, "状态信息")
        if (res.code === 200) {
          this.statusOptions = res.data;
        } else {
          this.$message.error('获取状态信息失败', 1000);
        }
      })
    },
    handleReset() {
      this.selectedIndustry = '';
      this.selectedCategory = '';
      this.selectedStatus = '';
      this.searchQuery = '';
      this.$message.success('筛选条件已重置', 500);
      this.QueryScriptlist()
    },
  }
};
</script>

<style scoped>
/* 自定义对话框样式 */
.custom-step-dialog .el-dialog__body {
  padding: 20px;
}

.dialog-content {
  width: 100%;
  border-bottom: 1px solid #666;
}

/* 信息行布局 */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding: 8px 0;
}

.info-label {
  font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
  font-weight: 500;
  font-size: 28px;
  color: #FFFFFF;
  line-height: 28px;
  text-align: left;
  font-style: normal;
  text-transform: none;
}

.info-latwo {
  color: #FFFFFF;
  font-size: 14px;
}

.info-time {
  font-size: 14px;
  color: #fff;
}

/* 倾斜标签样式 - 容器倾斜但文字保持水平 */
.skewed-tag {
  display: inline-block;
  border-radius: 0px;
  border: 1px solid #DDDDDD;
  padding: 4px 12px;
  font-size: 12px;
  color: #333;
  transform: skew(-10deg);
  background-color: #fff;
}

/* 确保标签内的文字不倾斜 */
.skewed-tag {
  display: inline-block;
  transform: skew(-10deg);
}

.skewed-tag {
  display: inline-block;
  transform: skew(-10deg);
}
</style>

<style scoped>
.standards-management-container {
  padding: 20px;
  color: #303133;
}

.card-header {
  font-size: 16px;
  font-weight: bold;
  color: #fff;
}

.search-card {
  margin-bottom: 20px;
  background-color: #04142B;
  border: none;
  max-width: 1600px;
  margin: 0 auto 20px;
}

/* 修改为纵向排列 */
.search-filters {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 15px 0;
}

/* 每个筛选组单独占一行 */
.filter-group {
  display: flex;
  align-items: center;
  margin-bottom: 0;
  width: 100%;
}

.filter-label {
  margin-right: 10px;
  font-weight: 500;
  white-space: nowrap;
  min-width: 60px;
  color: #fff;
}

/* 查询输入组也改为纵向排列的一部分 */
.search-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 0;
  width: 100%;
}

/* 单选按钮组在小屏幕上自动换行 */
:deep(.el-radio-group) {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* 修改result-card样式，简化设计去掉突出效果 */
.result-card {
  border-radius: 4px;
  margin-top: 15px;
  overflow: auto;
  background-color: #04142B;
}

/* 保留表格基本样式但不强制覆盖背景 */
:deep(.el-table) {
  border-top: 1px solid #ebeef5;
}

:deep(.el-table th) {
  background-color: #fafafa;
}

:deep(.el-table td) {
  background-color: #ffffff;
}

.searchinput {
  width: 300px;
  margin: 0 10px 0 0;
  height: 30px;
  background-color: transparent;
  border: 1px solid #fff;
  color: #fff;
  transform: skew(-10deg);
  padding: 0 10px;
}

/* 让输入的文字也倾斜 */
.searchinput {
  transform: skew(-10deg);
}

/* 让placeholder文字也倾斜 */
.searchinput::placeholder,
.searchinput::-webkit-input-placeholder,
.searchinput:-moz-placeholder,
.searchinput::-moz-placeholder,
.searchinput:-ms-input-placeholder {
  transform: skew(-10deg);
  color: white;
}

/* 全部按钮样式 */
.all-button {
  width: 58.8px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  cursor: pointer;
  border: 1px solid white;
  background: none;
  transform: skew(-5deg);
  border-radius: 4px;
  margin-right: 10px;
}

/* 全部按钮激活状态样式 */
.all-button.active {
  background: linear-gradient(360deg, #0085FF 0%, rgba(0, 163, 255, 0) 100%);
  border: 1px solid;
  border-top: none;
  border-radius: 4px;
  margin-right: 10px;
  transform: skew(-5deg);
  border-image: linear-gradient(180deg, rgba(0, 163, 255, 0), rgba(0, 163, 255, 1)) 1 1;
}

/* 全部按钮悬浮效果 */
.all-button:hover {
  background: linear-gradient(360deg, #0085FF 0%, rgba(0, 163, 255, 0) 100%);
  border: 1px solid;
  border-top: none;
  border-radius: 4px;
  border-image: linear-gradient(180deg, rgba(0, 163, 255, 0), rgba(0, 163, 255, 1)) 1 1;
}

.searchinput::placeholder {
  color: white;
  opacity: 0.7;
  margin-left: 10px;
}

:deep(.el-card__header) {
  border: none;
}

:deep(.el-radio-button) {
  margin-right: 5px;
}

:deep(.el-radio-button__inner) {
  background-color: #152133;
  border-color: #fff;
  color: #fff;
  border: 1px solid #fff;
  border-radius: 0px !important;

  /* 添加倾斜效果 */
  transform: skew(-5deg);
  /* 确保文字居中 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dialogqxbtn {
  width: 158px;
  height: 40px;
  color: #fff;
  text-align: center;
  font-size: 14px;
  line-height: 1;
  transform: skew(-15deg);
  background: #182F50;
  border-radius: 0px 0px 0px 0px;
  margin-left: 30px;
  border: 1px solid;
  border-image: linear-gradient(136deg, rgba(44, 223, 232, 1), rgba(26, 154, 219, 1), rgba(26, 154, 217, 1)) 1 1;
}

.dialogqxbtn span {
  transform: skew(15deg);
}

/* 查询重置按钮 */
.resetbutton {
  margin-left: 10px;

  width: 92px;
  height: 30px;
  text-align: center;
  line-height: 30px;
  font-size: 12px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #182F50;
  transform: skew(-10deg);
  border-radius: 0px 0px 0px 0px;
  border: 1px solid;
  border-radius: 4px;
  border-image: linear-gradient(136deg, rgba(44, 223, 232, 1), rgba(26, 154, 219, 1), rgba(26, 154, 217, 1)) 1 1;
}

.resetbutton span {
  transform: skew(10deg);
}

/* 移除重置按钮点击时的黑色边框 */
.resetbutton:focus {
  outline: none !important;
  border: 1px solid #1A9AD9;
  background: #182F50;
}

.resetbutton2 {
  width: 92px;
  height: 30px;
  text-align: center;
  line-height: 30px;
  font-size: 12px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  /* background: #182F50; */
  transform: skew(-10deg);
  background: linear-gradient(180deg, rgba(0, 135, 255, 0.25) 0%, rgba(0, 135, 255, 0.52) 100%);
  border-radius: 0px 0px 0px 0px;
  border: 1px solid;
  border-image: linear-gradient(136deg, rgba(44, 223, 232, 1), rgba(26, 154, 219, 1), rgba(26, 154, 217, 1)) 1 1;
}

.resetbutton2 span {
  transform: skew(10deg);
}

/* 移除重置按钮点击时的黑色边框 */
.resetbutton2:focus {
  outline: none !important;
  border: 1px solid #1A9AD9;
  background: #182F50;
}

.resetbutton2:hover {
  background: linear-gradient(360deg, #0085FF 0%, rgba(0, 163, 255, 0) 100%);
  border-radius: 0px 0px 0px 0px;
  border: 1px solid;
  border-image: linear-gradient(180deg, rgba(0, 163, 255, 0), rgba(0, 163, 255, 1)) 1 1;
  border-top: none;
}

/* 查询重置按钮 */
.dialogqxTwo {
  width: 158px;
  height: 40px;
  color: #fff;
  text-align: center;
  transform: skew(-15deg);
  margin-right: 30px;

  font-size: 14px;
  line-height: 1;
  background: linear-gradient(180deg, rgba(0, 135, 255, 0.25) 0%, rgba(0, 135, 255, 0.52) 100%);
  border-radius: 0px 0px 0px 0px;
  border: 1px solid;
  border-image: linear-gradient(136deg, rgba(44, 223, 232, 1), rgba(26, 154, 219, 1), rgba(26, 154, 217, 1)) 1 1;
}

.dialogqxTwo span {
  transform: skew(15deg);
}

/* :deep(.el-dialog__headerbtn) {
  display: none;
} */

.el-dialog__header {
  padding: 0;
  display: none;
}

/* 鼠标悬浮时的渐变背景效果 */
:deep(.el-radio-button:hover .el-radio-button__inner) {
  background: linear-gradient(360deg, #0085FF 0%, rgba(0, 163, 255, 0) 100%);
  border-radius: 0px 0px 0px 0px;
  border: 1px solid rgba(0, 163, 255, 0.5);
  border-top: none;
  /* border-image: linear-gradient(180deg, rgba(0, 163, 255, 0), rgba(0, 163, 255, 1)) 1 1; */
}

/* 选中状态样式 */
:deep(.el-radio-button.is-active .el-radio-button__inner) {
  background: linear-gradient(360deg, #0085FF 0%, rgba(0, 163, 255, 0) 100%);
  border-radius: 0px 0px 0px 0px;
  border: 1px solid;
  border-image: linear-gradient(180deg, rgba(0, 163, 255, 0), rgba(0, 163, 255, 1)) 1 1;
}

/* 按钮 */
/* 输入框 */

:deep(.el-input) {
  /* 设置输入框背景跟随主题色 */
  --el-input-bg-color: #152133;
  transform: skew(-5deg);

}

:deep(.el-input__inner) {
  /* 背景色跟随主题 */
  background-color: #152133 !important;
  /* 边框始终为白色 */
  border-color: white !important;
  /* 文字颜色为白色 */
  color: white !important;
  border: none;
}

:deep(.el-select .el-input__inner) {
  border: none;
}

/* 聚焦状态也保持白色边框 */
:deep(.el-input__inner:focus) {
  border-color: white !important;
  /* 移除默认的聚焦阴影效果或调整为浅色 */
}

/* 清除按钮样式 */
:deep(.el-input__clear) {
  color: white !important;
}

/* 搜索图标颜色 */
:deep(.el-input__prefix-inner .el-input__icon) {
  color: white !important;
}

/* 输入框 */



:deep(.el-button--primary) {
  background: linear-gradient(180deg, rgba(0, 135, 255, 0.25) 0%, rgba(0, 135, 255, 0.52) 100%) !important;
  border: none !important;
  background-color: transparent !important;
  /* 设置基础渐变背景 */
  /* background: linear-gradient(180deg, rgba(0, 135, 255, 0.25) 0%, rgba(0, 135, 255, 0.52) 100%) !important; */
  /* 确保文字为白色 */
  color: white !important;
  /* 移除默认边框或设置为透明 */
  border: none !important;
  /* 确保按钮内文字和图标颜色一致 */
  transform: skew(-5deg);
  width: 90px;
  height: 30px;
  border: 1px solid;
}

/* 查询按钮hover效果 */
:deep(.el-button--primary:hover) {
  background: linear-gradient(360deg, #0085FF 0%, rgba(0, 163, 255, 0) 100%) !important;
  border-color: transparent !important;
}






/* 执行按钮样式 */
.execute-button {
  width: 92px;
  height: 30px;
  text-align: center;
  line-height: 30px;
  font-size: 12px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  /* background: #182F50; */
  transform: skew(-10deg);
  background: linear-gradient(180deg, rgba(0, 135, 255, 0.25) 0%, rgba(0, 135, 255, 0.52) 100%);
  border-radius: 0px 0px 0px 0px;
  border: 1px solid;
  border-image: linear-gradient(136deg, rgba(44, 223, 232, 1), rgba(26, 154, 219, 1), rgba(26, 154, 217, 1)) 1 1;
  /* 移除默认的聚焦效果（黑色框） */
  outline: none;
  /* 确保所有状态下都没有轮廓 */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* 执行按钮hover效果 */


/* 确保按钮文本居中并设置文字大小和反向倾斜 */
.execute-button span {
  display: inline-block;
  font-size: 12px;
  /* 文字反向倾斜 10deg，使其看起来是正的 */
  transform: skew(10deg);
}

/* 确保按钮在被激活状态下也没有轮廓 */
.execute-button:active {
  outline: none;
}

/* 移除focus状态的轮廓 */
.execute-button:focus {
  outline: none;
}

/* 查询和重置按钮样式 */

/* 表格样式 */
:deep(.el-table) {
  background-color: #04142B !important;
  color: white;
}

/* 表格头部样式 */
:deep(.el-table__header-wrapper th) {
  background-color: #04142B !important;
  color: white !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.363);
}

/* 表格行样式 */
:deep(.el-table__row) {
  background-color: #04142B !important;
  color: white !important;
}

/* 表格单元格样式 */
:deep(.el-table__cell) {
  background-color: #04142B !important;
  color: white !important;
  /* border-bottom: 1px solid rgba(255, 255, 255, 0.363); */
  /* border-right: 1px solid rgba(255, 255, 255, 0.363); */
}

/* 表格边框样式 */
:deep(.el-table--border) {
  /* border: 1px solid rgba(255, 255, 255, 0.425) !important; */
  border-radius: 5px;
}

/* 移除表格底部的额外边框 */
:deep(.el-table::before) {
  background-color: transparent !important;
}

/* 表格hover效果 */
:deep(.el-table__row:hover > td) {
  background-color: rgba(255, 255, 255, 0.05) !important;
}


/* .el-dialog 弹窗样式优化 */
:deep(.el-dialog) {
  border: none;
}

:deep(.el-upload-dragger) {
  border: none;
}

:deep(.el-dialog__header) {
  border-bottom: none;
}

/* 分页 */
:deep(.el-pagination__total) {
  color: #fff;
}

:deep(.el-pagination__jump) {
  color: #fff;
}

:deep(.el-form-item__label) {
  color: #fff !important;
}

/* 操作按钮样式 */
.action-button {
  width: 100px;
  height: 25px;
  background: linear-gradient(180deg, rgba(0, 135, 255, 0.25) 0%, rgba(0, 135, 255, 0.52) 100%);
  border-radius: 0px;
  border: 1px solid;
  border-image: linear-gradient(136deg, rgba(44, 223, 232, 1), rgba(26, 154, 219, 1), rgba(26, 154, 217, 1)) 1 1;
  color: white;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  transform: skew(-15deg);
  /* 移除点击时的黑色框 */
  outline: none;
  /* 移除移动设备上的点击高亮 */
  -webkit-tap-highlight-color: transparent;
  /* 防止文本被选中 */
  user-select: none;
}

/* 为所有状态添加轮廓移除 */
.action-button:focus,
.action-button:active,
.action-button:hover {
  outline: none;
}

/* 按钮内文字反向倾斜，保持水平 */
.action-button span {
  display: inline-block;
  transform: skew(15deg);
  /* 与按钮倾斜角度相反 */
  transform-origin: center;
}

.action-button:hover {
  background: linear-gradient(180deg, rgba(0, 135, 255, 0.35) 0%, rgba(0, 135, 255, 0.62) 100%);
  border-image: linear-gradient(136deg, rgba(44, 223, 232, 1), rgba(26, 154, 219, 1), rgba(26, 154, 217, 1)) 1 1;
}

.action-button:active {
  background: linear-gradient(180deg, rgba(0, 135, 255, 0.45) 0%, rgba(0, 135, 255, 0.72) 100%);
}

/* 下载成功弹窗样式 */
.success-dialog {
  background: rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  box-shadow: none;
  border: none;
}

.success-content {
  text-align: center;
  padding: 20px 0;
}

.success-icon {
  width: 88px;
  height: 88px;
  margin-bottom: 15px;
}

.success-text {
  font-family: Noto Sans SC, Noto Sans SC;
  font-weight: 500;
  font-size: 30px;
  color: #fff;
  margin-top: 20px;
}

/* 隐藏弹窗的默认边框和头部 */
.success-dialog .el-dialog__header {
  display: none;
}

.success-dialog .el-dialog__body {
  padding: 0;
  background: transparent;
}

/* 移除背景遮罩层 */
.success-dialog+.v-modal {
  display: none;
}


:deep(.el-step__title.is-finish) {
  color: #fff;
}

:deep(.el-step__description.is-finish) {
  color: #fff;
}

:deep(.el-step__title.is-process) {
  color: #fff;
}

:deep(.el-step__description.is-process) {
  color: #fff;
}

/* 步骤条 */
:deep(.el-step__title.is-success) {
  color: #ffffff;
}
:deep(.el-step__description.is-success) {
  color: #ffffff;
}
</style>
<style>
.el-radio-button__inner:focus {
  outline: none;
}

.el-button:focus {
  outline: none;
}

/* 简化全局覆盖样式 */
.standards-management-container .el-card.result-card {
  border: 1px solid #ebeef5;
}
</style>